import 'package:json_annotation/json_annotation.dart';
import 'package:objectbox/objectbox.dart';
//数据库生成: flutter pub run build_runner build
//定义生成的文件 flutter pub run build_runner build --delete-conflicting-outputs
part 'models_upload_order_task.g.dart';


// //上传任务2.0
// @JsonSerializable(explicitToJson: true)
// @Entity()
// class DBUploadOrder20 {
//   @Id()
//   int id=0;
//   String? uuid;
//   String? orderMsg;
//
//   String? fastOrderNo;  //离线订单号
//
//   String? json;
//
//   String? createDate;
//   int createDateLong=0;
//
//   DBUploadOrder20(
//       {
//         this.id=0,
//         this.createDateLong=0,
//       }
//       ); //添加固定格式
//   factory DBUploadOrder20.fromJson(Map<String, dynamic> json) => _$DBUploadOrder20FromJson(json);
//   Map<String, dynamic> toJson() => _$DBUploadOrder20ToJson(this);
//
// }

//上传任务
@JsonSerializable(explicitToJson: true)
@Entity()
class BeanUploadOrderTask {
  @Id()
  int id=0;
  String? uuid;
  String? orderMsg;

  String? functionTypes;//功能类型
  String? orderType;//订单类型,零售,预售,赊销
  String? member;//会员名
  String? phone;//会员电话
  String? shoppingGuide;//导购
  String? cashier;//收银员
  String? orderStatus;//订单状态
  String? orderStatusName;//订单状态
  String? payStatus;//收银状态
  String? payStatusName;//收银状态


  String? typeCode;//传输类型编码 1新增 2支付 3取消 4整单退货
  String? fastOrderNo;  //离线订单号

  String? pushJson;

  //每一笔支付流水list<String>的字符串
  String? payListJson;

  //提交版本号
  String? pushVersion;
  //提交客户端(checkstand智慧收银台,fast_checkstand智慧收银台(极速版),guide_ios 睿本云app苹果,guide_android 睿本云app安卓)|
  String? pushClient;


  bool synSuccess=false;//是否同步成功
  bool businessSuccess=false;//业务是否执行成功

  bool isFailedTaskUpLoading=false;//失败任务是否正在上传中
  int failedTaskUploadCount=0;//失败重试次数

  String? orderId;//api返回

  String? createDate;
  int createDateLong=0;
  String? modifyDate;

  String? uploadOrderType;//上传订单1 上传订单2

  BeanUploadOrderTask(
      {
        this.uploadOrderType,
        this.id=0,
        this.uuid,
        this.orderMsg,
        this.functionTypes,
        this.orderType,
        this.member,
        this.phone,
        this.shoppingGuide,
        this.cashier,
        this.orderStatus,
        this.orderStatusName,
        this.payStatus,
        this.payStatusName,
        this.typeCode,
        this.fastOrderNo,
        this.pushJson,
        this.payListJson,
        this.pushVersion,
        this.pushClient,
        this.synSuccess=false,
        this.businessSuccess=false,
        this.isFailedTaskUpLoading=false,
        this.failedTaskUploadCount=0,
        this.orderId,
        this.createDate,
        this.createDateLong=0,
        this.modifyDate
      }
      );

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is BeanUploadOrderTask &&
          runtimeType == other.runtimeType &&
          fastOrderNo == other.fastOrderNo;

  @override
  int get hashCode => fastOrderNo.hashCode;

  //添加固定格式
  factory BeanUploadOrderTask.fromJson(Map<String, dynamic> json) => _$BeanUploadOrderTaskFromJson(json);
  Map<String, dynamic> toJson() => _$BeanUploadOrderTaskToJson(this);

}

//上传任务备份
@JsonSerializable(explicitToJson: true)
@Entity()
class BeanUploadOrderTaskBak {
  @Id()
  int id=0;

  int taskId=0;
  String? uuid;
  String? orderMsg;

  String? functionTypes;//功能类型
  String? orderType;//订单类型,零售,预售,赊销
  String? member;//会员名
  String? phone;//会员电话
  String? shoppingGuide;//导购
  String? cashier;//收银员
  String? orderStatus;//订单状态
  String? orderStatusName;//订单状态
  String? payStatus;//收银状态
  String? payStatusName;//收银状态


  String? typeCode;//传输类型编码 1新增 2支付 3取消 4整单退货
  String? fastOrderNo;  //离线订单号

  String? pushJson;

  //每一笔支付流水list<String>的字符串
  String? payListJson;

  //提交版本号
  String? pushVersion;
  //提交客户端(checkstand智慧收银台,fast_checkstand智慧收银台(极速版),guide_ios 睿本云app苹果,guide_android 睿本云app安卓)|
  String? pushClient;


  bool synSuccess=false;//是否同步成功
  bool businessSuccess=false;//业务是否执行成功

  String? orderId;//api返回

  String? createDate;
  int createDateLong=0;
  String? modifyDate;


  BeanUploadOrderTaskBak(
      {
        this.id=0,
        this.taskId=0,
        this.uuid,
        this.orderMsg,
        this.functionTypes,
        this.orderType,
        this.member,
        this.phone,
        this.shoppingGuide,
        this.cashier,
        this.orderStatus,
        this.orderStatusName,
        this.payStatus,
        this.payStatusName,
        this.typeCode,
        this.fastOrderNo,
        this.pushJson,
        this.payListJson,
        this.pushVersion,
        this.pushClient,
        this.synSuccess=false,
        this.businessSuccess=false,
        this.orderId,
        this.createDate,
        this.createDateLong=0,
        this.modifyDate
      }
      ); //添加固定格式
  factory BeanUploadOrderTaskBak.fromJson(Map<String, dynamic> json) => _$BeanUploadOrderTaskBakFromJson(json);
  Map<String, dynamic> toJson() => _$BeanUploadOrderTaskBakToJson(this);

}


//新增订单
@JsonSerializable(explicitToJson: true)
@Entity()
class BeanUploadOrderDetail {
  @Id()
  int id=0;
  String? uuid;
  String? orderMsg;

  String? functionTypes;//功能类型
  String? orderType;//订单类型,零售,预售,赊销
  String? member;//会员名
  String? phone;//会员电话
  String? shoppingGuide;//导购
  String? cashier;//收银员
  String? orderStatus;//订单状态
  String? orderStatusName;//订单状态
  String? payStatus;//收银状态
  String? payStatusName;//收银状态


  String? typeCode;//传输类型编码 1新增 2支付 3取消 4整单退货
  String? fastOrderNo;  //离线订单号

  String? pushJson;

  //每一笔支付流水list<String>的字符串
  String? payListJson;

  //提交版本号
  String? pushVersion;
  //提交客户端(checkstand智慧收银台,fast_checkstand智慧收银台(极速版),guide_ios 睿本云app苹果,guide_android 睿本云app安卓)|
  String? pushClient;


  bool synSuccess=false;//是否同步成功
  bool businessSuccess=false;//业务是否执行成功

  String? orderId;//api返回

  String? createDate;
  int createDateLong=0;
  String? modifyDate;

  double? totalMoney;
  double? totalCount;
  double? totalQuantity;


  BeanUploadOrderDetail(
      {
        this.id=0,
        this.uuid,
        this.orderMsg,
        this.functionTypes,
        this.orderType,
        this.member,
        this.phone,
        this.shoppingGuide,
        this.cashier,
        this.orderStatus,
        this.orderStatusName,
        this.payStatus,
        this.payStatusName,
        this.typeCode,
        this.fastOrderNo,
        this.pushJson,
        this.payListJson,
        this.pushVersion,
        this.pushClient,
        this.synSuccess=false,
        this.businessSuccess=false,
        this.orderId,
        this.createDate,
        this.createDateLong=0,
        this.modifyDate,
        this.totalMoney,
        this.totalCount,
        this.totalQuantity,
      }
      ); //添加固定格式
  factory BeanUploadOrderDetail.fromJson(Map<String, dynamic> json) => _$BeanUploadOrderDetailFromJson(json);
  Map<String, dynamic> toJson() => _$BeanUploadOrderDetailToJson(this);

}



// //订单记录备份
// @JsonSerializable(explicitToJson: true)
// @Entity()
// class BeanCompleteUploadOrder {
//   @Id()
//   int id=0;
//   String? fastOrderNo;
//   String? createDate;
//   int createDateLong=0;
//
//   BeanCompleteUploadOrder(
//       {
//         this.id=0,
//         this.fastOrderNo,
//         this.createDate,
//         this.createDateLong=0,
//       }
//       ); //添加固定格式
//   factory BeanCompleteUploadOrder.fromJson(Map<String, dynamic> json) => _$BeanCompleteUploadOrderFromJson(json);
//   Map<String, dynamic> toJson() => _$BeanCompleteUploadOrderToJson(this);
//
// }


//购物车
@JsonSerializable(explicitToJson: true)
@Entity()
class BeanUploadOrderShoppingCart {
  @Id()
  int id=0;
  String? fastOrderNo;
  String? pushJson;
  String? createDate;
  int createDateLong=0;

  BeanUploadOrderShoppingCart(
      {
        this.id=0,
        this.fastOrderNo,
        this.pushJson,
        this.createDate,
        this.createDateLong=0,
      }
      ); //添加固定格式
  factory BeanUploadOrderShoppingCart.fromJson(Map<String, dynamic> json) => _$BeanUploadOrderShoppingCartFromJson(json);
  Map<String, dynamic> toJson() => _$BeanUploadOrderShoppingCartToJson(this);

}

@JsonSerializable(explicitToJson: true)
@Entity()
class BeanOfflinePay {
  @Id()
  int id=0;
   String? requsetId;//
   String? fastOrderNo;  //
   int createDateLong;
   String? json;

  BeanOfflinePay(
      {
        this.id=0,
        this.fastOrderNo,
        this.requsetId,
        this.json,
        this.createDateLong=0,
      }
      );

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is BeanOfflinePay &&
          runtimeType == other.runtimeType &&
          requsetId == other.requsetId;

  @override
  int get hashCode => requsetId.hashCode;

  //添加固定格式


  factory BeanOfflinePay.fromJson(Map<String, dynamic> json) => _$BeanOfflinePayFromJson(json);
  Map<String, dynamic> toJson() => _$BeanOfflinePayToJson(this);

}
